001
<tr>
		<th>类型</th>
		<th>4G</th>
		<th>5G</th>
	</tr>s
	<tr>
		<td><input type="checkbox" name="shop" title="华为" value="hw" lay-filter="shop"></td>
		<td>
			<input type="number" id="hwBili4g" value="70" disabled class="layui-input hwBili bili"/>
			<label>%</label>
		</td>
		<td>
			<input type="number" id="hwBili5g" value="70" disabled class="layui-input hwBili bili"/>
			<label>%</label>
		</td>
	</tr>
	<tr>
		<td><input type="checkbox" name="shop" title="爱立信" value="er" lay-filter="shop"></td>
		<td>
			<input type="number" id="erBili4g" value="30" disabled class="layui-input erBili bili"/>
			<label>%</label>
		</td>
		<td>
			<input type="number" id="erBili5g" value="30" disabled class="layui-input erBili bili"/>
			<label>%</label>
		</td>
	</tr>
	<tr>
		<td><input type="checkbox" name="shop" title="中兴" value="zx" lay-filter="shop"></td>
		<td>
			<input type="number" id="zxBili4g" value="0" disabled class="layui-input zxBili bili"/>
			<label>%</label>
		</td>
		<td>
			<input type="number" id="zxBili5g" value="0" disabled class="layui-input zxBili bili"/>
			<label>%</label>
		</td>
	</tr>
	<tr>
		<td>总用户</td>
		<td>
			<input type="number" id="yongHuShu4g" value="1200" class="layui-input"/>
			<label>万</label>
		</td>
		<td>
			<input type="number" id="yongHuShu5g" value="1200" class="layui-input"/>
			<label>万</label>
		</td>
	</tr>
	
	002
	function getC(bili4g,bili5g){
		let hw=calcC(yongHuShu4g_dom.value*bili4g[0],yongHuShu5g_dom.value*bili5g[0],'华为')
		let er=calcC(yongHuShu4g_dom.value*bili4g[1],yongHuShu5g_dom.value*bili5g[1],'爱立信')
		let zx=calcC(yongHuShu4g_dom.value*bili4g[2],yongHuShu5g_dom.value*bili5g[2],'中兴')
		return {list:[...getDetail('HW',hw),...getDetail('ER',er),...getDetail('ZX',zx)]}
	}
	// 获取指定厂家大致情况
	function calcC(yongHuShu4g,yongHuShu5g,name){
		let yongHuShu=Number(yongHuShu4g)+Number(yongHuShu5g)
		let ruanJian=yongHuShu*getUserToPdu()/(liYongLv_dom.value/100)
		let yingJian=ruanJian*2
		let ruanJian5g=yongHuShu5g*getUserToPdu()/(liYongLv_dom.value/100)*(zhuLiuBi_dom.value/100)
		let yingJian5g=ruanJian5g*2
		let taoShu=Math.ceil(yingJian/fenLie_dom.value)
		taoShu=taoShu%2==0?taoShu:taoShu+1
		let overRuanJian=taoShu==0?0:Math.round(ruanJian/taoShu)
		let overYingJian=taoShu==0?0:Math.round(yingJian/taoShu)
		let overRuanJian5g=taoShu==0?0:Math.round(ruanJian5g/taoShu)
		let overYingJian5g=taoShu==0?0:Math.round(yingJian5g/taoShu)
		return {name,yingJian,yingJian5g,ruanJian,ruanJian5g,taoShu,overRuanJian,overYingJian,overRuanJian5g,overYingJian5g}
	}
	// 获取指定厂家具体情况
	function getDetail(type,all){
		let list=[],nowRuanJian,nowYingJian,nowRuanJian5g,nowYingJian5g,nowWangYuans=uploadFile[sheetName.wangYuan],
		wangYuanNowNum=0
		for(let wangYuan of nowWangYuans){
			if(wangYuan.shop==translate[type]){
				wangYuanNowNum++
			}
		}
		for(let i=0;i<all.taoShu;i++){
			if(i>wangYuanNowNum){
				getNow(0)
			}else{
				getNow(nowWangYuans[i])
			}
			let name=province+wangYuanName+type+i
			overRuanJian=all.overRuanJian
			overRuanJian5g=all.overRuanJian5g
			overYingJian=all.overYingJian
			overYingJian5g=all.overYingJian5g
			let item=createRes({shop:translate[type],name})
			list.push(item)
		}
		return list
	}
	function getU(bili4g,bili5g){
		let hw=calcU(yongHuShu4g_dom.value*bili4g[0],yongHuShu5g_dom.value*bili5g[0],'华为')
		let er=calcU(yongHuShu4g_dom.value*bili4g[1],yongHuShu5g_dom.value*bili5g[1],'爱立信')
		let zx=calcU(yongHuShu4g_dom.value*bili4g[2],yongHuShu5g_dom.value*bili5g[2],'中兴')
		return {all:[hw,er,zx],list:[...getDetail('HW',hw.taoShu),...getDetail('ER',er.taoShu),...getDetail('ZX',zx.taoShu)]}
	}
	function calcU(yongHuShu4g,yongHuShu5g,name){
		let yongHuShu=Number(yongHuShu4g)+Number(yongHuShu5g)
		let yingJian=yongHuShu*getUserToPdu()*liuLiang_dom.value*10000/1024/1024
		let ruanJian=yongHuShu*getUserToPdu()/(liYongLv_dom.value/100)
		let yingJian5g=yongHuShu5g*getUserToPdu()*liuLiang_dom.value*10000/1024/1024
		let ruanJian5g=yongHuShu5g*getUserToPdu()/(liYongLv_dom.value/100)*(zhuLiuBi_dom.value/100)
		let taoShu=Math.ceil(yingJian/fenLie_dom.value)
		taoShu=taoShu%2==0?taoShu:taoShu+1
		let overRuanJian=taoShu==0?0:Math.round(ruanJian/taoShu)
		let overYingJian=taoShu==0?0:Math.round(yingJian/taoShu)
		return {name,yingJian,yingJian5g,ruanJian,ruanJian5g,taoShu,overRuanJian,overYingJian}
	}
	
	003
	function getBili(){
		let allBili4g=0,allBili5g=0
		let bili4g,bili5g
		let bili4gList=[],bili5gList=[]
		for(let i=0;i<document.getElementsByClassName('bili').length;i++){
			if(i%2){
				bili4g=document.getElementsByClassName('bili')[i].value*1/100
				allBili4g+=bili4g
				bili4gList.push(bili4g)
			}else{
				bili5g=document.getElementsByClassName('bili')[i].value*1/100
				allBili5g+=bili5g
				bili5gList.push(bili5g)
			}
		}
		if(allBili4g>1||allBili5g>1){
			layer.msg('比例错误', {icon: 2,time: 2000});
			return
		}
		return {bili4gList,bili5gList}
	}
	
	004
	
	function calculateByBili(){
		let bill=getBili()
		let finalData=mian=='c'?getC(bill.bili4gList,bill.bili5gList):getU(bill.bili4gList,bill.bili5gList)
		let totalListData={shop:'',name:'总计',overYingJian:0,overYingJian5g:0,overRuanJian:0,overRuanJian5g:0,
		unit:menXian[wangYuan].unit,disaster:'',pool:''}
		let totalAllData={name:'总计'}
		let totalTaoShu=0
		for(let i of finalData.all){
			totalListData.overYingJian+=i.yingJian
			totalListData.overYingJian5g+=i.yingJian5g
			totalListData.overRuanJian+=i.ruanJian
			totalListData.overRuanJian5g+=i.ruanJian5g
			totalTaoShu+=i.taoShu
		}
		totalAllData.yingJian=totalListData.overYingJian
		totalAllData.yingJian5g=totalListData.overYingJian5g
		totalAllData.ruanJian=totalListData.overRuanJian
		totalAllData.ruanJian5g=totalListData.overRuanJian5g
		totalAllData.taoShu=totalTaoShu
		finalData.list.push(totalListData)
		finalData.all.push(totalAllData)
		console.log(finalData);
		return finalData
	}
	
	005
	function changeInput(type,data){
		if(data.value==type){
			if([...data.othis[0].classList].includes('layui-form-checked')){
				for(let i of document.getElementsByClassName(type+'Bili')){
					i.removeAttribute('disabled')
				}
			}else{
				for(let i of document.getElementsByClassName(type+'Bili')){
					i.setAttribute('disabled','disabled')
					i.value=0
				}
			}
		}
	}
	form.on('checkbox(shop)',function(data){
		for(let i of ['hw','er','zx']){
			changeInput(i,data)
		}
	})